<?php

namespace JsonLowCode\Traits\Props;

use JsonLowCode\Enum\ButtonType;

/**
 * 设置组件属性type
 */
trait HasType
{
    /**
     * 渐变文字的类型
     * @param ButtonType $type 'primary' | 'info' | 'success' | 'warning' | 'error' 是否js表达式
     * @return $this
     */
    public function type(ButtonType $type): static
    {
        return $this->prop('type', $type);
    }

    /**
     * primary
     * @return $this
     */
    public function primary(): static
    {
        return $this->type('primary');
    }

    /**
     * info
     * @return $this
     */
    public function info(): static
    {
        return $this->type('info');
    }

    /**
     * success
     * @return $this
     */
    public function success(): static
    {
        return $this->type('success');
    }

    /**
     * warning
     * @return $this
     */
    public function warning(): static
    {
        return $this->type('warning');
    }

    /**
     * warning
     * @return $this
     */
    public function error(): static
    {
        return $this->type('error');
    }


}
